package com.example.ktpspringboot.mapper;

import com.example.ktpspringboot.entity.Course;
import com.example.ktpspringboot.entity.Student;
import com.example.ktpspringboot.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CourseMapper {
    /**
     * 以下六个方法是分别查询学生和老师的所学的课程
     */
    public List<Course> queryStuStudyCourseByPhone(String phone);

    public List<Course> queryTeaStudyCourseByPhone(String phone);

    public List<Course> queryStuStudyCourseByEmail(String email);

    public List<Course> queryTeaStudyCourseByEmail(String email);

    public List<Course> queryStuStudyCourseByAccount(String account);

    public List<Course> queryTeaStudyCourseByAccount(String account);

    /**
     * 以下三个方法是查询老师所教的课程
     */
    public List<Course> queryTeachCourseByPhone(String phone);

    public List<Course> queryTeachCourseByEmail(String phone);

    public List<Course> queryTeachCourseByAccount(String phone);

    /**
     * 以下六个方法是分别查询学生和老师的所协助的课程
     */
    public List<Course> queryStuHelpCourseByPhone(String phone);

    public List<Course> queryTeaHelpCourseByPhone(String phone);

    public List<Course> queryStuHelpCourseByEmail(String email);

    public List<Course> queryTeaHelpCourseByEmail(String email);

    public List<Course> queryStuHelpCourseByAccount(String account);

    public List<Course> queryTeaHelpCourseByAccount(String account);


    public List<Course> findStuTopCourseByPhone(String phone);

    public List<Course> findStuTopCourseByEmail(String Email);

    public List<Course> findStuTopCourseByAccount(String account);

    public List<Course> findTeaTopCourseByPhone(String Email);

    public List<Course> findTeaTopCourseByEmail(String Email);

    public List<Course> findTeaTopCourseByAccount(String account);

    public String findCourseByCode(String code);

    public String findStuByEmail(String email);

    public String findStuByPhone(String phone);
    public String findStuByAccount(String phone);

    public String findTeaByEmail(String email);

    public String findTeaByPhone(String phone);
    public String findTeaByAccount(String phone);

    public int insertStudentStudyCourse(String stuName, String courseName);

    public int insertStudentHelpCourse(String stuName, String courseName);

    public int insertTeacherStudyCourse(String teaName, String courseName);

    public int insertTeacherHelpCourse(String teaName, String courseName);

    public int insertTeacherTeachCourse(String teaName, String courseName);

    public String selectStuCourse(String stuName, String courseName);

    public String selectTeaCourse(String teaName, String courseName);

    public int selectStudentNumber(String studyClass);

    public int insertCourse(Course course);

    public int toppingCourse(String courseCode);

    public int cancelToppingCourse(String courseCode);

    void updateCourseNumber(String courseUuid);

    //根据课程code查询课程id
    String findCourseIDByCode(String code);

    List<Teacher> findTeacherByCourseCode(String courseCode);
    //根据课程code查询满足条件的教师数量
    int countTeacherByCourseCode(String courseCode);

}
